package com.kai.steering.data.service.entity.domainObject;

import cn.hutool.core.bean.BeanUtil;
import com.kai.steering.data.service.entity.po.Permission;
import com.kai.steering.data.service.entity.po.Role;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ToString
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "RoleDO对象", description = "角色业务实体")

public class RoleDO implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "角色id")
    private String id;
    @ApiModelProperty(value = "角色名字")
    private String name;
    @ApiModelProperty(value = "角色详情")
    private String description;
    @ApiModelProperty(value = "权限")
    private List<PermissionDO> permissions;

    public RoleDO(Role role) {
        convertPermissionDO(role);
    }
    public RoleDO convertPermissionDO(Role role){
        BeanUtil.copyProperties(role, this);
        return this;
    }
}
